package com.xiexin.orderset.service.impl;

import com.xiexin.orderset.domain.Ordersetting;
import com.xiexin.orderset.mapper.OrdersettingMapper;
import com.xiexin.orderset.service.IOrdersettingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 预约设置Service业务层处理
 *
 * @author xieixin
 * @date 2022-03-25
 */
@Service
public class OrdersettingServiceImpl implements IOrdersettingService {
    @Resource
    private OrdersettingMapper ordersettingMapper;

    /**
     * 查询预约设置
     *
     * @param id 预约设置主键
     * @return 预约设置
     */
    @Override
    public Ordersetting selectOrdersettingById(Long id) {
        return ordersettingMapper.selectOrdersettingById(id);
    }

    /**
     * 查询预约设置列表
     *
     * @param ordersetting 预约设置
     * @return 预约设置
     */
    @Override
    public List<Ordersetting> selectOrdersettingList(Ordersetting ordersetting) {
        return ordersettingMapper.selectOrdersettingList(ordersetting);
    }

    /**
     * 新增预约设置
     *
     * @param ordersetting 预约设置
     * @return 结果
     */
    @Override
    public int insertOrdersetting(Ordersetting ordersetting) {
        return ordersettingMapper.insertOrdersetting(ordersetting);
    }

    /**
     * 修改预约设置
     *
     * @param ordersetting 预约设置
     * @return 结果
     */
    @Override
    public int updateOrdersetting(Ordersetting ordersetting) {
        return ordersettingMapper.updateOrdersetting(ordersetting);
    }

    /**
     * 批量删除预约设置
     *
     * @param ids 需要删除的预约设置主键
     * @return 结果
     */
    @Override
    public int deleteOrdersettingByIds(Long[] ids) {
        return ordersettingMapper.deleteOrdersettingByIds(ids);
    }

    /**
     * 删除预约设置信息
     *
     * @param id 预约设置主键
     * @return 结果
     */
    @Override
    public int deleteOrdersettingById(Long id) {
        return ordersettingMapper.deleteOrdersettingById(id);
    }

    @Override
    public List<Ordersetting> getOrderDate7Days() {
        return ordersettingMapper.getOrderDate7Days();
    }
    //批量 导入  excel 数据
    public void add(List<Ordersetting> ordersettingList) {
        for (Ordersetting ordersetting : ordersettingList) {
            ordersettingMapper.insertOrdersetting(ordersetting);
        }
    }

}
